﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FeCMS.Entity.AccessControlModule;

namespace Test.MockClass
{
    /// <summary>
    ///     虚拟出一个权限的数据库类出来
    /// </summary>
   public  class MockPermissionDBEntity
    {
       public static PermissionDBEntity Get()
       {
           return new PermissionDBEntity(4,3)
           {
               //权限
               Permission = new Dictionary<int, Permission>() {
                {1,new Permission(){
                         ID=1,
                         Name="add",
                         Description="添加"
                    }
                },{2,new Permission(){
                         ID=2,
                         Name="del",
                         Description="删除"
                    }
                },{3,new Permission(){
                         ID=3,
                         Name="edit",
                         Description="修改"
                    }
                },{4,new Permission(){
                         ID=4,
                         Name="search",
                         Description="查询"
                    }
                }
               },
               //角色
               Role =new Dictionary<int,Role>(){
                  {1,new Role(){
                   ID=1,
                   Enabled =true,
                   Permission=new int[]{1,2},
                   Description ="测试角色1",
                   Name="管理员"
                  }},{2,new Role(){
                   ID=2,
                   Enabled =true,
                   Permission=new int[]{3,4},
                   Description ="测试角色2",
                   Name="黑客"
                  }},{3,new Role(){
                   ID=3,
                   Enabled =false,
                   Permission=new int[]{3,4},
                   Description ="测试角色3",
                   Name="黑客"
                  }}
               },
               //管理员
               Admin = new Dictionary<string, Admin>() {
                    {"admin1",
                        new Admin()
                        { 
                            Enabled =true,
                            Password="123456",
                            RoleID=new int[]{1},
                            UserName="admin1",
                            PrivatePermission=new int[]{3}
                        } 
                    },{"admin2",
                        new Admin()
                        { 
                            Enabled =true,
                            Password="123456",
                            RoleID=new int[]{1,2},
                            UserName="admin2",
                            PrivatePermission=new int[]{5,6}
                        } 
                    },{"admin3",
                        new Admin()
                        { 
                            Enabled =true,
                            Password="123456",
                            RoleID=new int[]{2},
                            UserName="admin3",
                            PrivatePermission=new int[]{3,4}
                        } 
                    },{"admin4",
                        new Admin()
                        { 
                            Enabled =false,
                            Password="123456",
                            RoleID=new int[]{2},
                            UserName="admin4",
                            PrivatePermission=new int[]{3,4}
                        } 
                    },{"admin5",
                        new Admin()
                        { 
                            Enabled =true,
                            Password="123456",
                            RoleID=new int[]{1,3},
                            UserName="admin5",
                            PrivatePermission=new int[]{3}
                        } 
                    }
               }
           };
       }
    }
}
